package com.itheima05;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Tcp06 {
    public static void main(String[] args) throws IOException {

        ServerSocket serverSocket = new ServerSocket(10000);

        Socket accept = serverSocket.accept();

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        String hostAddress = accept.getInetAddress().getHostAddress();

        String line;
        while ((line = bufferedReader.readLine()) != null) {
            System.out.println(hostAddress + "说" + line);
        }

        serverSocket.close();
    }
}
